package com.system.demo.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import com.sun.istack.NotNull;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Setter
@Getter
@ToString
@Entity
@Table
@EntityListeners(AuditingEntityListener.class)
public class Member {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int id;//主键
	@NotNull
	@Column(nullable = false)
	private String cardNo;//会员卡号
	@NotNull
	@Column(nullable = false)
	private String name;//姓名
	private String sex;//性别
	@Column(name="category",columnDefinition="tinyint default 0")
	private int category=0;//身份,0表示学生，1表示老师
	@Column(unique = true,length = 18)
	private String card;//身份证号，唯一，用来保证每个用户只能有一个会员卡
	private String department;//系
	private String profession;//专业
	private String grade;//年级
	@NotNull
	@Column(nullable = false,length = 11)
	private String phone;//电话
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	@CreatedDate
	private Date regdate;//入会时间
	@Column(name="status",columnDefinition="tinyint default 0")
	private int status=0;//状态，0表示没有使用任何资源，其他状态填写资源id
	private String remark;//备注
}



